#!/bin/bash

#
# Script to copy all needed project files into a build directory for release
#

BUILD_DST=build
BUILD_FILES=`ls *.py *.yaml`

BUILD_DIRS=`ls -d */ | sed -e "s/\/\///g" | grep -v ${BUILD_DST} | grep -v lib`

if [ ! -d ${BUILD_DST} ]
then
    echo "Creating ${BUILD_DST} directory"
    mkdir ${BUILD_DST}
fi

echo -en "Copying files ..."
for file in ${BUILD_FILES}
do
    cp ${file} ${BUILD_DST}/${file}
done
echo -e "done"

echo -en "Copying dirs..."
for dir in ${BUILD_DIRS}
do
    cp -r ${dir} ${BUILD_DST}/${dir}
done
echo -e "done"

echo -en "Removing tests dirs.."
find ${BUILD_DST} -name tests | xargs rm -rf
echo -e "done"

